#include <iostream>
#include <string>
using namespace std;

const double Pi = 3.1415;

class Shape
{
protected:
	double radius; //radius for sphere and cylinder, side for cube
public:
	Shape(double r) { radius = r; }
	virtual double Volume() = 0;
	virtual double Surface() = 0;
};

class Sphere:public Shape
{
public:
	Sphere(double r):Shape(r) {};
	double Volume () { return radius*radius*radius*Pi*4/3; }
	double Surface() { return 4*Pi*radius*radius; }
};

class Cylinder:public Shape
{
	double height;
public:
	Cylinder(double r, double h):Shape(r),height(h) {};
	double Volume() { return Pi*radius*radius*height; }
	double Surface() { return (2*Pi*radius*height + 2*Pi*radius*radius);}
};

class Cube:public Shape
{
public:
	Cube(double r):Shape(r) {};
	double Volume() { return radius*radius*radius; }
	double Surface() { return 6*radius*radius; }
};